﻿using Microsoft.EntityFrameworkCore.Migrations;

namespace Batman.Jianbei.Forum.Migrations.ChatRoomDb
{
    public partial class _201907151 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Mask_MaskAlbum_AlbumId",
                table: "Mask");

            migrationBuilder.DropIndex(
                name: "IX_Mask_AlbumId",
                table: "Mask");

            migrationBuilder.DropColumn(
                name: "AlbumId",
                table: "Mask");

            migrationBuilder.AlterColumn<string>(
                name: "AvatarId",
                table: "Mask",
                nullable: true,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_Mask_AvatarId",
                table: "Mask",
                column: "AvatarId");

            migrationBuilder.AddForeignKey(
                name: "FK_Mask_Image_AvatarId",
                table: "Mask",
                column: "AvatarId",
                principalTable: "Image",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Mask_Image_AvatarId",
                table: "Mask");

            migrationBuilder.DropIndex(
                name: "IX_Mask_AvatarId",
                table: "Mask");

            migrationBuilder.AlterColumn<string>(
                name: "AvatarId",
                table: "Mask",
                nullable: true,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AddColumn<string>(
                name: "AlbumId",
                table: "Mask",
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_Mask_AlbumId",
                table: "Mask",
                column: "AlbumId");

            migrationBuilder.AddForeignKey(
                name: "FK_Mask_MaskAlbum_AlbumId",
                table: "Mask",
                column: "AlbumId",
                principalTable: "MaskAlbum",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }
    }
}
